FROM nvidia/cuda:10.2-cudnn7-runtime-ubuntu18.04


RUN sed -i s@/archive.ubuntu.com/@/mirrors.aliyun.com/@g /etc/apt/sources.list
RUN apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 'A4B469963BF863CC'
RUN apt-get update -y

ENV TIME_ZONE Asia/Shanghai

ENV DEBIAN_FRONTEND=noninteractive

# Add user
RUN adduser --quiet --disabled-password qtuser && usermod -a -G audio qtuser

# This fix: libGL error: No matching fbConfigs or visuals found
ENV LIBGL_ALWAYS_INDIRECT=1

# Install Python 3, PyQt5


RUN  apt-get update
RUN  apt-get install      python3 -y
RUN  apt-get install      python3-pyqt5 -y
RUN  apt-get install      python3-pip -y
RUN  apt-get install      libgl1-mesa-glx -y
RUN  apt-get install      libxss1 -y
RUN  apt-get install      libappindicator1 -y
RUN  apt-get install      libindicator7 -y
RUN  apt-get install      libjpeg8-dev -y
RUN  apt-get install      libpng-dev -y
RUN  apt-get install      libtiff5-dev -y
RUN  apt-get install      zlib1g-dev -y
RUN  apt-get install      libleptonica-dev -y
RUN  apt-get install      libtesseract-dev -y
RUN  apt-get install      tesseract-ocr -y
RUN  apt-get install      fonts-liberation -y
RUN  apt-get install      libappindicator3-1 -y
RUN  apt-get install      libasound2 -y
RUN  apt-get install      libnspr4 -y
RUN  apt-get install      libnss3 -y
RUN  apt-get install      xdg-utils -y
RUN  apt-get install      libcanberra-gtk-module -y
RUN  apt-get install      tcl-dev -y
RUN  apt-get install      tk-dev -y
RUN  apt-get install      python3-tk -y
RUN  apt-get install      dbus -y
RUN  apt-get install      locales -y
RUN  apt-get install      ttf-wqy-microhei -y
RUN  apt-get install      language-pack-zh-hans -y

ENV LANG  zh_CN.UTF-8
ENV LANGUAGE zh_CN:zh

COPY hello.py /tmp/hello.py

#sudo docker build -t='bewithmeallmylife/10.2-cudnn7-runtime-ubuntu18.04-python3-qt5:1.0.0' .
#sudo docker run --rm --gpus '"device=0"' -it -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=$DISPLAY -u qtuser bewithmeallmylife/10.2-cudnn7-runtime-ubuntu18.04-python3-qt5:1.0.0  python3 /tmp/hello.py
